import { hasAuth } from '../router/utils'

export const auth = {
  inserted(el, binding){
    const { value } = binding
    
    if (value)
      !hasAuth(value) && el.parentNode?.removeChild(el)

    else
      throw new Error(`need auths! Like v-auth="['btn.add','btn.edit']" or v-auth="'btn.add'"`)
  }
}